const fs = require("fs");
var readfile = new Promise(function (resolve, reject) {
    fs.readFile("js/readme.txt", (error, data) => {
        if (error) reject(error);
        resolve(data)
    });
});

readfile.then(data=>{
    console.log("回调成功");
    console.log(data.toString());
}).catch(error=>{
    console.log('错误'+error);
})